package appapi.dao;
import org.apache.ibatis.annotations.Param;

import appapi.entity.Zhongjiao.OnsitedetailDto;
import appapi.entity.app.OnsitedetailEntity;import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author djq
 * @date 2023/5/23 15:07
 * @description:
 */

@Mapper
public interface OnsitedetailMapper {
    int deleteByPrimaryKey(Long onsiteRecId);

    int deleteByOnsiteId(@Param("onsiteId")Long onsiteId);

    int insert(OnsitedetailDto record);

    int insertEntiSelective(OnsitedetailEntity record);

    int insertSelective(OnsitedetailDto record);

    OnsitedetailDto selectByPrimaryKey(Long onsiteRecId);

    int updateByPrimaryKeySelective(OnsitedetailDto record);

    int updateByPrimaryKey(OnsitedetailDto record);

    int insertList(List<OnsitedetailEntity> onsitedetail);

    List<Map<String, Object>> selectAllByOnsiteId(long onsiteId);

    List<OnsitedetailDto> selectByOnsiteId(Long onsiteId);

    int deleteByOnsiteIds(@Param("onsiteIds")List<Long> onsiteIds);

    @Select("SELECT * FROM onsitedetail o " +
            "JOIN project p ON o.proj_id = p.proj_id " +
            "JOIN organization org ON p.orga_id = org.orga_id " +
            "WHERE org.orga_id = #{orgaId}")
    List<OnsitedetailEntity> listOnsites(@Param("orgaId") Integer orgaId);

}